﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;

namespace LordJS.Extensions
{
    public static class TemplateExtensions
    {
        public static MvcHtmlString LoadTemplate(this HtmlHelper htmlHelper, string scriptID, string templateName)
        {
            TagBuilder scriptTag = new TagBuilder("script");
            scriptTag.GenerateId(scriptID);
            scriptTag.MergeAttribute("type", "text/x-jquery-tmpl");
            scriptTag.InnerHtml = htmlHelper.Partial(templateName).ToString();
            return MvcHtmlString.Create(scriptTag.ToString());
        }
    }
}